﻿create sequence Documents_ID
  minvalue 1        --最小值
  nomaxvalue        --不设置最大值
  start with 1      --从1开始计数
  increment by 1    --每次加1个
  nocycle           --一直累加，不循环 
  nocache          --不建缓冲区


CREATE TABLE Documents(
ID NUMBER(38,0)  NOT NULL PRIMARY KEY,
DNAME NVARCHAR2(100),
FileName NVARCHAR2(100),
DocumentFile BLOB,
DocumentType NVARCHAR2(512),
CreateTime DATE default SYSDATE,
Submiter NVARCHAR2(20))

--创建需要分别执行：
CREATE OR REPLACE TRIGGER Documents_primary
BEFORE INSERT ON padmin.Documents FOR EACH ROW WHEN (new.id is null) 
BEGIN
 	 select padmin.Documents_ID.nextval into:new.id from dual;
end;